﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 五分钟倒计时
{
    public class MyLabel : Label
    {
        protected override void OnPaint(PaintEventArgs e)
        {
            Color backColor = this.BackColor;
            Pen pen = new Pen(Color.Empty, 0f);
            SolidBrush brush = new SolidBrush(backColor);
            SolidBrush brush2 = new SolidBrush(this.ForeColor);
            float width = (float)base.Size.Width;
            float height = (float)base.Size.Height;
            e.Graphics.DrawRectangle(pen, 0f, 0f, width, height);
            e.Graphics.FillRectangle(brush, 0f, 0f, width, height);
            e.Graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            e.Graphics.DrawString(this.Text, this.Font, brush2, 0f, 0f);
        }
    }
}
